package com.rfid.afd.activity;

import android.os.Bundle;
import android.os.Handler;
import android.text.TextUtils;
import android.view.View;

import androidx.annotation.Nullable;

import com.rfid.afd.activity.view.ICheckBookView;
import com.rfid.afd.presenter.CheckPresenter;
import com.rfid.db.bean.Operation;
import com.rfid.db.bean.Rfid;

import java.util.List;

import butterknife.BindView;
/**先扫描层标，得到层标下所有书籍信息吗，然后进行盘点，扫到一本删除一本，最后剩下的都是没盘点到的。其中盘点到不属于这个层架信息的书籍也显示出来。*/
public class CheckActivity extends BaseCommonUiActivity<CheckPresenter> implements ICheckBookView {
    boolean isStarted;


    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
    }

    @Override
    public CheckPresenter getPresenter() {
        return new CheckPresenter();
    }


    @Override
    public void onScaned(String epc, Rfid rfid) {
        super.onScaned(epc, rfid);
        if(rfid.getId() != null)
            mPresenter.addOperationLog(rfid, Operation.OPERATE_CHECK);
    }


    @Override
    protected void onShelfGot(String shelf) {
        System.out.println("onShelfGot");
        mPresenter.getLocatedData(mShelf);
    }

    @Override
    public void onRfidsQueryedByShelf(List<Rfid> rfids) {
        System.out.println("onRfidsQueryedByShelf");
         new Handler().postDelayed(new Runnable() {
             @Override
             public void run() {
                 updateData(rfids);
             }
         },500);
//        mPresenter.startScanRfid();
    }
}
